namespace Wips.AppService.SqlSugar.Authorities.Users
{
    /// <summary>
    /// 用户缓存通知处理程序
    /// </summary>
    public class UserCacheNotificationHandler
        // INotificationHandler<UserRemovedEvent>,
        // INotificationHandler<UserDisabledEvent>
    {
        // private readonly IPermissionCacheService _userCacheService;
        // private readonly INoticeHubService? _noticeHubService;
        //
        //
        // /// <summary>
        // /// 
        // /// </summary>
        // public UserCacheNotificationHandler()
        // {
        // }
        //
        // /// <summary>
        // /// 
        // /// </summary>
        // /// <param name="userCacheService"></param>
        // public UserCacheNotificationHandler(
        //     IPermissionCacheService userCacheService)
        //
        // {
        //     _userCacheService = userCacheService;
        //     // _noticeHubService = noticeHubService;
        // }
        //
        // /// <summary>
        // /// 
        // /// </summary>
        // /// <param name="userCacheService"></param>
        // /// <param name="noticeHubService"></param>
        // public UserCacheNotificationHandler(
        //     IPermissionCacheService userCacheService, INoticeHubService noticeHubService)
        //
        // {
        //     _userCacheService = userCacheService;
        //     _noticeHubService = noticeHubService;
        // }
        //
        // /// <summary>
        // /// 用户删除事件
        // /// </summary>
        // /// <param name="notification"></param>
        // /// <param name="cancellationToken"></param>
        // /// <returns></returns>
        // public async Task Handle(UserRemovedEvent notification, CancellationToken cancellationToken)
        // {
        //     // 移除缓存
        //     await _userCacheService.ClearOperationPermissionsAsync("",notification.UserId); // 发送通知
        //     if (_noticeHubService != null)
        //     {
        //         await _noticeHubService.SendMessageToUserAsync(notification.UserId, new SignalRMessage<string>
        //         {
        //             Type = MessageType.Event,
        //             EventType = "UserRemovedEvent",
        //             Data = "您的帐号已被禁用，如有疑问请联系管理员。"
        //         });
        //     }
        //
        //   
        // }
        //
        // /// <summary>
        // /// 用户被禁用事件
        // /// </summary>
        // /// <param name="notification"></param>
        // /// <param name="cancellationToken"></param>
        // public async Task Handle(UserDisabledEvent notification, CancellationToken cancellationToken)
        // {
        //     // 移除缓存
        //     await _userCacheService.ClearOperationPermissionsAsync("",notification.UserId);
        //     // 发送通知
        //     if (_noticeHubService != null)
        //     {
        //         await _noticeHubService.SendMessageToUserAsync(notification.UserId, new SignalRMessage<string>
        //         {
        //             Type = MessageType.Event,
        //             EventType = "UserDisabledEvent",
        //             Data = "您的帐号已被禁用，如有疑问请联系管理员。"
        //         });
        //     }
        // }
    }
}